c = [1, 2]
print(type(c))
print(type(iter(c)))
# iter可以点击去 意思就是将一个序列或者一个可迭代对象变成一个迭代器
print('test'+"*"*100)  # 需要在研究研究iter方法


def test():
    a = [[1, 1], [2, 2], [3, 3]]
    for j in a:
        yield j


for i in test():
    print(i)  # 这个属于正常输出
print('test1'+"*"*100)


def test1():
    a = [[1, 1], [2, 2], [3, 3]]
    for j in iter(a):
        yield j


for i in test1():
    print(i)  # 从输出结果来看 iter(a)和直接下a的效果是一样的因为列表本身就是个可迭代对象
print('test2'+"*"*100)


def test2():
    a = [[1, 1], [2, 2], [3, 3]]
    for j in iter(a):
        # print('j', j) j为[1, 1]
        yield from j  # 从输出结果来看这个from的作用相当于遍历了一遍j


for i in test2():
    print(i)
print('test2'+"*"*100)


def test2():
    a = [[1, 1], [2, 2], [3, 3]]
    for j in iter(a):
        # print('j', j) j为[1, 1]
        yield from iter(j)  # iter加了也没啥变化


for i in test2():
    print(i)


# def test3():
#     a = [1, 2, 3, 4]
#     for j in a:
#         yield from j  # 直接报错了 j不可迭代 说明了from后边接的是个可迭代对象
#
#
# for i in test3():
#     print(i)
# print('test3'+"*"*100)

